home *** CD-ROM | disk | FTP | other *** search
- Copyright (c) 1993 by Roy S. Woll
-
- Class "str", Version 2.1 3/1/93
-
- You may distribute and sell any executable which results from using this code
- in your applications. You may redistribute this source freely as long as you
- leave all files in their original form, including the copyright notice as is.
- You may NOT include any SOURCE code of this software with any program that is
- sold.
-
- I would sincerely welcome any comments/criticism/ideas you might have about
- the str or the regular expression class.
-
- If you use the product, please register by sending $15.00 to
- Roy S. Woll, 1032 Summerplace Dr., San Jose, CA 95122. You will receive
- an enhanced version of the class, more extensive documentation,
- and updates as they are made available.
-
-
- ------------------------------------------
- | |
- | Roy S. Woll |
- | 1032 Summerplace Dr. |
- | San Jose, CA 95122 |
- | |
- | CompuServe : 76207,2541 |
- | |
- | Phone: (408) 778-2000 x4518 (day) |
- | (408) 293-5893 (evening) |
- | |
- ------------------------------------------
-
-
- In addition those of you who register will receive a more powerful
- version of the regular expression class that includes context-sensitive
- regular expressions. For instance you will easily be able to search or
- replace a specific portion (flagged by '@') of a regular expression.
-
-
- regX employeeX("Pay to the order of @[A-Za-z\\s]+$");
- str paycheck("Payroll\nPay to the order of Roy S. Woll\n$50,000");
- str employee;
-
- paycheck.search(employeeX, &employee);
- paycheck.replace(employeeX, "a lucky person");
-
- //
- // After executing the above code, employee will contain the
- // name of the person following the text "Pay to the order of ".
- //
- // employee = "Roy S. Woll"
- // paycheck = "Payroll\nPay to the order of lucky person\n$50,000"
- //
-
-
- ------------------------------------------------------------------------------
-
- FILES: THE FOLLOWING FILES ARE INCLUDED.
-
- str.doc Documentation file for str class.
-
- str.h Interface file for str class
- regX.h Interface file for regular expression class
- regXimp.h Interface file used only for implementation of regX
- dynstream.h Interface file for dynstream class
- bcstr.h Interface file for BCstr class. BCstr is compatible
- with the Borland object-based container classes.
- It is derived from str.
-
- str.cpp Implementation file for str class
- regX.cpp Implementation file for regular expression class
- dynstream.cpp Implementation file for dynstream class
- match.cpp Regular expression compiling and searching routines
- strsearch.cpp Member functions relating to search/replace
- bcstr.cpp Implementation file for BCstr class
- strcmp.cpp Non-ansi string routines used by str class. Add
- this to your library if your system does not have
- these (stricmp, strnicmp, strupr, strlwr).
-
- grep.cpp Demo program for "str" class, supporting
- file searching of regular expression matches.
- Supports wildcard file specifications, case
- sensitivity, line numbers, etc.)
-
- makefile This program defines how to build str.lib
- readme Brief overview
-
-
- ------------------------------------------------------------------------------
-
- INSTALLATION AND USE:
- ---------------------
-
- STR.LIB
- -------
- Type "make" to compile the source and create a library called
- str.lib If you wish to place the object files in your own
- library, insert the .obj files into your library. You may
- also want to place "str.h", and "regular.h" into your default
- include path. Bcstr.h is provided for those who wish to use
- the Borland object-based container classes to store str's.
-
- If you are using Turbo C++ instead of Borland C++, edit the
- makefile and substitute "TCC" for "BCC".
-
- Unix, Vax-Vms, and some other systems may also need to add
- strcmp.obj to the library. This module defines non-ansi string
- routines used by str class. Add this to your library if your
- system does not have these (stricmp, strnicmp, strupr, strlwr).
-
-
- GREP
- ----
- Type "make grep" to create the executable for grep.
- Grep is included as a demonstration program for the str class.
- It supports searching of literal and regular expression
- within files. Wildcard file specifications, case sensitivity,
- line numbers, etc. are all supported. The implementatin uses
- only around 1 page of code, which demostrates how natural coding
- is when using the regular expression capabilities of the string
- class.
-
-
- UPGRADING
- ---------
- If you are upgrading from version 1, then you will need to
- recompile all .cpp files that use the str class. This must be
- done since str.h has changed. You also will need to change
- occurances of pad or strip to use the global versions. This must
- be done since the member functions pad and strip now modify their
- object. See section "Whats changed in 2.00".
-
-
- USING
- -----
- You will need to include <str.h>, "str.h" in order to use class
- str. If you also wish to use regular expressions include
- <regX.h>, "regX.h". Header files "dynstream.h" and
- "regximp.h" are strictly for implementation. and as such are
- separated into other header file. You should never reference them
- unless you wish to modify their implementation, or derive a new
- class from them.
-
-
- ------------------------------------------------------------------------------
-
- WHATS DIFFERENT ABOUT VERSION 2.0 - 2.1
- ---------------------------------------
-
-
- WHATS DIFFERENT ABOUT VERSION 2.1
- ---------------------------------
-
- Version 2.1 extends regular expression support to include context
- sensitive regular expressions. See section on regular expressions
- for more details.
-
-
- WHATS CHANGED IN 2.02 and 2.11
- ------------------------------
- Friend operator >> for reading in strings now directly uses the
- string buffer, so as to remove the 256 character limit.
-
- Grep now supports files in other drives and directories.
-
- Optimizations to efficiency in str::_assign which is used
- by many str member functions.
-
- Regular expression character sets can now contain octal characters.
-
- Fix - Member function "remove" now transfers only necessary
- characters. May have caused Windows application error
- previously.
-
-
- WHATS CHANGED IN 2.01
- ---------------------
-
- This version supports compatibility with Turbo C++. Previous
- versions would fail to compile due to Turbo C++'s incorrect
- handling of nested classes.
-
- WHATS NEW IN 2.00
- -----------------
-
- 1. Searching and replacing of character strings and regular
- expressions.
-
- 2. Case sensitivity now is a property of each instance of str. All
- searching and comparing for the str instance automatically
- reflects its case sensitivity. During comparisons between two
- strings, the case sensitivity of the first argument is used.
- Instances of str modify their case sensitivity through member
- functions setCaseSensitive(int).
-
- {
- str a=("abcd efgh");
- a.setCaseSensitive(0); // a is now case insensitive
- str b=("ABCD EFGH");
- cout << a.search("efGH"); // "1" Found
- cout << b.search("efGH"); // "0" Not found
-
- cout << (a==b); // "1" Are equal
- cout << (b==a); // "0" Not equal
- }
-
- 3. Miscellaneous optimizations and fixes.
-
-
-
-
- WHATS GONE IN 2.00
- ------------------
- Member function iindex is not directly supported. Instead use
- member function setCaseSensitive(int) to tell a string instance if
- its searching and comparing should be case sensitive or not. The
- default is case sensitive.
-
-
-
- WHATS CHANGED IN 2.00
- ---------------------
- Member functions pad and strip now modify their object. Use
- global functions pad and strip to just return a value. These
- funtions were changed so that there would be a consistency among
- member functions. If the member function makes sense to modify
- its object, then it will. I apologize for those of you who will
- have to change your code to reflect this. But your code will be
- more readable after you make the modifications. You'll have to
- change occurances such as the following.
-
-
-
- Old Way New Way
- ------- -------
- str a="abc"; str a = "abc";
- str b = a.pad(10); str b = pad(a, 10);
-
-
-